﻿@using Webdiyer.WebControls.Mvc;
@model PagedList<Inspinia_MVC5.Models.Admin>

    <table class="table table-striped">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.AdminName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.AdminUserName)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.AdminPassword)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.IsRoot)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.AuthoPwd)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.LoginTime)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.AdminPhone)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.AdminName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AdminUserName)
                </td>
                <td>
                    @{
                        if (item.IsRoot == 1)
                        {
                            <span class="label label-primary">超级管理员密码不可见</span>
                        }
                    }
                </td>
                <td>
                    @{ 
                        if (item.IsRoot == 1)
                        {
                            <span class="label label-primary">超级管理员</span>
                        }
                    }
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AuthoPwd)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.LoginTime)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.AdminPhone)
                </td>
                <td>
                    @Html.ActionLink("详情", "Details", new { id = item.AdminId }, new { @class = "btn btn-primary btn-sm" })
                    @Html.ActionLink("编辑", "Edit", new { id = item.AdminId }, new { @class = "btn btn-white btn-sm" })
                    @{
                        if (item.IsRoot != 1)
                        {
                            @Html.ActionLink("删除", "Delete", new { id = item.AdminId }, new { @class = "btn btn-white btn-sm" })
                        }
                        else
                        {
                            <span class="label label-danger">不可删除</span>
                        }
                    }
                </td>
            </tr>
        }

    </table>